<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jspf"%>
<!DOCTYPE html>
<html>
  <head>
    <title>menu.html</title>
	
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
<link rel="stylesheet" type="text/css" href="${proPath }/css/bootstrap.min.css">
<!--[if lt IE 9]>
  <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript" src="${proPath }/js/jquery.min.js"></script>
<script type="text/javascript" src="${proPath }/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${proPath }/js/bootstrap-treeview.js"></script>
<script type="text/javascript" src="${proPath }/js/jquery-form.js"></script>
<script type="text/javascript" src="${proPath }/js/bootbox.js"></script>
</head>
  
<body>
<div class="row">
	<div class="col-md-12 col-xs-12 col-sm-12">
		<nav id="bs-navbar" class="collapse navbar-collapse navbar-inverse">
			<div class="navbar-header">
				<button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false">
					<span class="sr-only">文件管理系统</span> <span class="icon-bar"></span><span class="icon-bar"></span> <span class="icon-bar"></span>
				</button>
				<a href="#" class="navbar-brand">文件管理系统</a>
			</div>
			<ul class="nav navbar-nav navbar-right">
				<li><a href="#">当前用户：${sessionScope.SYS_USER.account}</a></li>
				<c:if test="${sessionScope.SYS_USER.userType == 0}">
					<li><a href="javascript:void(0);" onclick="userManagerModalShow()"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a></li>
				</c:if>
				<li><a href="javascript:void(0);" data-toggle="modal" data-target="#sysParamModal"><span class="glyphicon glyphicon-oil" aria-hidden="true"></span></a></li>
			</ul>
		</nav>
	</div>
</div>
	<div class="row">
		<div class="col-md-2 col-xs-12 col-sm-12">
			<button type="button" class="btn btn-primary btn-mds btn-block" onclick="searchFile()">搜索</button>
			<div id="tree"></div>
		</div>
		<div class="col-md-10 col-xs-12 col-sm-12">
			<div id="mainIframe"></div>
		</div>
	</div>
<!--搜索文件 Modal -->
<div class="modal fade bs-example-modal-lg" id="searchFileMobal" tabindex="-1" role="dialog" aria-labelledby="searchFileLabel"></div>
<!-- 新建文件夹Modal -->
<div class="modal fade" id="addNewFolderModal" tabindex="-1" role="dialog" aria-labelledby="addNewFolderLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">新建文件夹</h4>
			</div>
			<form id="addNewFolderForm" action="${proPath}/fileManagerController/insertFileFolder" method="post">
				<div class="modal-body">
					<fieldset>
						<div class="form-group">
							<label>将创建在此文件夹下</label>
							<div id="addNewFolderTree"></div>
						</div>
						<div class="form-group">
							<label for="folderFileName">文件夹名称</label>
							<input type="hidden" name="parentId" />
							<input type="hidden" name="parentStrCn"  />
							<input type="hidden" name="level"/>
							<input type="text" id="folderFileName" name="fileName" class="form-control" placeholder="我是文件夹名称" />
						</div>
						<div class="form-group">
							<label for="folderRemarks">备注</label>
							<input type="text" id="folderRemarks" name="remarks" class="form-control" placeholder="我是150字以内的备注">
						</div>
					</fieldset>
				</div>
				<div class="modal-footer">
					<div class="col-md-6">
						<button type="button" onclick="submitAddNewForm()" class="btn btn-primary btn-block">确定</button>
					</div>
					<div class="col-md-6">
						<button type="button" class="btn btn-primary btn-block" data-dismiss="modal">取消</button>
					</div>
				</div>
			</form>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- 上传文件Modal -->
<div class="modal fade" id="fileUploadModal" tabindex="-1" role="dialog" aria-labelledby="fileUploadLabel"></div>
<!-- 修改Modal -->
<div class="modal fade" tabindex="-1" role="dialog" id="updateModal"></div><!-- /.modal -->	
<!-- 图片Modal -->
<div class="modal fade bs-example-modal-sm" id="ImageModal" tabindex="-1" role="dialog" aria-labelledby="ImageModalLabel" width:"300px">
	<div class="modal-dialog" role="document">
		<div class="modal-content" style="width: 400px;">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title">下载</h4>
				</div>
				<div class="modal-body" style="text-align: center;">
					<img alt="" src="" id="image" class="img-rounded" >
				</div>
				<div class="modal-footer">
					<div class="row">
						<div class="col-md-6">
							<button type="button" onclick="download(this)" class="btn btn-primary btn-block">下载</button>
						</div>
						<div class="col-md-6">
							<button type="button" class="btn btn-primary btn-block" data-dismiss="modal">取消</button>
						</div>
					</div>
				</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>

<!-- 账号管理 Modal-->
<div class="modal fade" tabindex="-1" role="dialog" id="userManagerModal">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title">账户管理</h4>
			</div>
			<div class="modal-body">
				<!-- 单选框 -->
				<div class="radio">
				  <label>
				     <input type="radio" name="userType" id="optionsRadios1" value="1" onclick="PasswordChange('1')" checked="checked">管理员
				  </label>
				   <label>
				     <input type="radio" name="userType" id="optionsRadios2" value="0" onclick="PasswordChange('0')">技术人员
				  </label>
				</div>
				<div class="form-group" id="showPassword">
					<label class="control-label" for="password">旧密码:</label> <input type="text" class="form-control" id="oldpassword" aria-describedby="inputSuccess2Status">
				</div>
				<div class="form-group ">
					<label class="control-label" for="password">新密码:</label> <input type="password" class="form-control" id="newpassword" aria-describedby="inputSuccess2Status">
				</div>
				<div class="form-group ">
					<label class="control-label" for="password">再次输入:</label> <input type="password" class="form-control" id="newpassword2" aria-describedby="inputSuccess2Status">
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary btn-md btn-block" onclick="AccountSumbit('${sessionScope.SYS_USER.id}','${sessionScope.SYS_USER.account }')" id="login">修改</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>

<!-- 系统参数Modal -->
<div class="modal fade" id="sysParamModal" tabindex="-1" role="dialog" aria-labelledby="sysParamModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content" >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">编辑文件属性值</h4>
      </div>
      <div class="modal-body">
      	<div class="row">
      		<div class="col-md-6">
      			<div class="row" style="margin-bottom: 10px;">
			        <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='sysType' >&nbsp;系统类型</span>
			        </button>
			        <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='productType'>&nbsp;产品类型</span>
			        </button>
			     </div>
			    <div class="row" style="margin-bottom: 10px;">
			    	 <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='productModel'>&nbsp;产品型号</span>
			        </button>
			       <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='productName'>&nbsp;产品名称</span>
			        </button>
			    </div>
			    <div class="row" style="margin-bottom: 10px;">
			    	 <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='version'>&nbsp;文档版本</span>
			        </button>
			        <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='usageScenarios'>&nbsp;使用场景</span>
			        </button>
			    </div>
			    <div class="row" style="margin-bottom: 10px;">
			    	 <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='specialNum'>特殊单编号</span>
			        </button>
			       <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type="uploadUser">&nbsp;上传人员</span>
			        </button>
			    </div>
			    <div class="row" style="margin-bottom: 10px;">
			    	 <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='documentType'>&nbsp;文档编号</span>
			        </button>
			       <button type="button" class="btn btn-primary" onclick="getSysParamDetails(this)">
			        	<span class="glyphicon glyphicon-edit" aria-hidden="true" type='materiel'>&nbsp;物料编码</span>
			        </button>
			    </div>
		    </div>
		    <div class="col-md-6" id="updateSysParamDiv">
		    	
		    </div>
        </div>
      </div>
     <!--  <div class="modal-footer">
        <button type="button" class="btn btn-primary" onclick="submitSysParamUpdate()" data-dismiss="modal">确定</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
      </div> -->
    </div>
  </div>
</div>
</body>
<script type="text/javascript">

$(function () {;
	loadTreeRoot();
});

$("#mainIframe").on("click",".pagination li",function(){
	 var current = $(this),  
    target = current.find('a').attr('href'); // 找到链接a中的targer的值 
    //console.log(target);
    $.get(target,function(data){
        $("#mainIframe").html(data);
     });  
    return false;
});
$("#mainIframe").on("click",".breadcrumb li",function(){
	 var current = $(this),  
   target = current.find('a').attr('href'); // 找到链接a中的targer的值 
   //console.log(target);
   $.get(target,function(data){
       $("#mainIframe").html(data);
    });  
   return false;
});

function loadTreeRoot(){
	//初始化树形结构
	$.ajax({
		type : "POST",
		url : "${proPath}/fileManagerController/getFileManagerTree",
		dataType : "json",
		success : function(data) {
			//console.info(data);
			if (data != null) {
				$('#tree').treeview({data: [data],levels: 4,
					  onNodeSelected: function(event, data) {
						  $.get(data.href,function(data){  
						        $("#mainIframe").html(data);
						  });
					  }
				});	
			}
			//获取根节点
			 var rootNode = $('#tree').treeview('getNode', 0);
			 $.get(rootNode.href,function(data){  
			      $("#mainIframe").html(data);
			 });
			 //选中根节点
			 $('#tree').treeview('selectNode', [ 0, { silent: true } ]);
		},
		error : function() {
			alert("加载左侧菜单失败!");
		}
	});
}
/*
 * 
 *点击新建文件夹按钮
 */
function addNewFolder(){
	$("#addNewFolderForm").get(0).reset();
	$.ajax({
		type : "POST",
		url : "${proPath}/fileManagerController/getFileManagerTree",
		dataType : "json",
		success : function(data) {
			if (data != null) {
				$('#addNewFolderTree').treeview({data: [data],levels: 1,});	
				var fileName = $(".breadcrumb li").last().attr('filename');
				var id = $(".breadcrumb li").last().attr('lid');
				if(fileName!=null && fileName!="" && (typeof fileName !=undefined)){
					var searchNodes = $('#addNewFolderTree').treeview('search', [fileName, {
						  ignoreCase: false,     // case insensitive
						  exactMatch: true,    // like or equals
						  revealResults: true,  // reveal matching nodes
					}]); 
					 for(var x = 0 ;x<searchNodes.length ;x++){
						if(id==searchNodes[x].id){
							 $('#addNewFolderTree').treeview('selectNode', [ searchNodes[x].nodeId, { silent: true } ]);
							 break ;
						}
					} 
				}
			}
		},
		error : function() {alert("加载文件树形结构失败!");}
	});
	$("#addNewFolderModal").modal("show");
}
/**
 * 新建文件夹提交
 */
function submitAddNewForm(){
	var selectedNodeArr = $('#addNewFolderTree').treeview("getSelected");
	if (selectedNodeArr == null || selectedNodeArr.length <= 0) {
		alert("请选择在哪个文件夹下添加新文件夹!");
		return;
	}
	var selectedNode = selectedNodeArr[0];
	//console.info(selectedNode);
	$("#addNewFolderForm input[name='parentId']").val(selectedNode.id);
	var parentStrCn = selectedNode.level==0?selectedNode.text:selectedNode.parentStrCn +" -> "+selectedNode.text ;
	$("#addNewFolderForm input[name='parentStrCn']").val(parentStrCn);
	$("#addNewFolderForm input[name='level']").val(selectedNode.level + 1);
	var fileNameVal = $("#folderFileName").val();
	if ("" == fileNameVal || fileNameVal.length > 64) {
		alert("请输入文件夹名称且文件名称在64个字符以内!");
		return;
	}
	$.ajax({
		type : "POST",
		url : "${proPath}/fileManagerController/insertFileFolder",
		data:$("#addNewFolderForm").serialize(),
		dataType : "json",
		success : function(data) {
			if (data != null) {
				loadTreeRoot();
				bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
				$("#addNewFolderModal").modal("hide");
			}
		}
	});
}
/**
 * 删除
 */
function del(obj){
	var oTr = $(obj).parent().parent();
	var id = oTr.attr("id");
	var fileType = oTr.attr("fileType");
	bootbox.confirm({
		buttons : {confirm : {label : '确认',className : 'btn btn-primary'},cancel : {label : '取消',className : 'btn btn-primary'}},
		message : '删除文件夹将删除文件夹下的所有子文件及子文件夹。',
		title : "你确定删除吗？",
		callback : function(result) {
			if(result){
				$.ajax({
					type : "POST",
					url : "${proPath}/fileManagerController/delete",
					data : {"id":id},
					dataType:"json",
					success : function(data) {
						if(data!=null){
							if(fileType==0){
								loadTreeRoot();
							}else{
								var target = $(".breadcrumb li").last().find('a').attr('href');
								$.get(target,function(data){
					                 $("#mainIframe").html(data);
					            });  
							}
							bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
						}
					},
					error : function() {
						bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : '删除失败'});
					}
				}); 
			}
		}
	});
}
/**
 * 上传文件按钮
 */
function fileUpload(){
	var lis = $(".breadcrumb li");
	if(lis==null || lis.length<=0){
		bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : "请先选择当前目录，才可进行上传文件！"});
		return false ;
	}
	$.ajax({
		type : "POST",
		url : "${proPath}/sysParamDictController/selectSysParamDictlist",
		success : function(data) {
			if(data!=null){
				$("#fileUploadModal").html(data);
				$.get("${proPath}/fileUpload.jsp",function(data){
					var oLi = $(".breadcrumb li:last");
					$("#fileUploadForm input[name='parentId']").val(oLi.attr("lid"));
					console.info($("#fileUploadForm input[name='parentId']").val());
					var parentStrCn = oLi.attr("level")==0?oLi.attr("fileName"):oLi.attr("parentStrCn") +" -> "+oLi.attr("fileName") ;
					$("#fileUploadForm input[name='parentStrCn']").val(parentStrCn);
					$("#fileUploadForm input[name='level']").val(oLi.attr("level") + 1);
					$("#fileUploadModal").modal("show");
	           });  
			}
		}
	});
}
//文件上传提交
function fileUploadFormSubmit(){
	var fileUpload = $("#fileUploadForm input[name='fileUpload']").val();
	if(fileUpload==null || fileUpload==""){
		bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : '请选择文件再进行上传!'});
		return false;
	}
	var options = {  
        url:'${proPath}/fileManagerController/fileUpload',
        success:function(data){
        	if(data.status==1){
        		var target = $(".breadcrumb li").last().find('a').attr('href');
				$.get(target,function(data){
	                 $("#mainIframe").html(data);
	            });
        		$("#fileUploadModal").modal("hide");
        		bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
        	}else{
	        	bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
        	}
        }, 
        error:function(){
        	bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : "当前文件大于50MB,上传失败！"});
        },
        resetForm: true,  
        dataType:'json',
        data:$("#fileUploadForm").serialize()
	 };  
	$("#fileUploadForm").ajaxSubmit(options);
}
/**
 * 修改
 */
function update(obj){
	 var oTr = $(obj).parent().parent();
	 var id = oTr.attr("id");
	 var fileName = oTr.attr("fileName");
	 var fileType = oTr.attr("fileType");
	 $.ajax({
			type : "POST",
			url : "${proPath}/fileManagerController/selectFileManagerDetailById",
			data:{"id":id , "fileType":fileType},
			success : function(data) {
				$("#updateModal").html(data);
				if(fileType==0){
					$.ajax({
						type : "POST",
						url : "${proPath}/fileManagerController/getFileManagerTree",
						dataType : "json",
						success : function(data) {
							if (data != null) {
								$('#updateFolderTree').treeview({data: [data],levels: 1,});	

								 var searchNodes = $('#updateFolderTree').treeview('search', [fileName, {
									  ignoreCase: false,     // case insensitive
									  exactMatch: true,    // like or equals
									  revealResults: true,  // reveal matching nodes
								}]); 
								 for(var x = 0 ;x<searchNodes.length ;x++){
									console.info();
									if(id==searchNodes[x].id){
										 $('#updateFolderTree').treeview('selectNode', [ searchNodes[x].nodeId, { silent: true } ]);
										 break ;
									}
								} 
							}
						},
						error : function() {alert("加载文件树形结构失败!");}
					});
				}
				$("#updateModal").modal("show");
			}
		});
}
/**
 * 修改文件夹提交
 */
function updateFolderSubmit(){
	var fileName = $("#updateFolderForm input[name='fileName']").val();
	if ("" == fileName || fileName.length > 64) {
		alert("文件夹名称不能为空且在64个字符以内!");
		return;
	}
	var selectedNodeArr = $('#updateFolderTree').treeview("getSelected");
	if (selectedNodeArr == null || selectedNodeArr.length <= 0) {
		alert("请选择此文件移动的位置!");
		return;
	}
	var selectedNode = selectedNodeArr[0];
	console.info(selectedNode);
	if( ($("#updateFolderForm input[name='id']").val())== (selectedNode.id) ){
		$("#updateFolderForm input[name='parentId']").val(selectedNode.parent_Id);
	}else{
		$("#updateFolderForm input[name='parentId']").val(selectedNode.id);
	}
	$.ajax({
		type : "POST",
		url : "${proPath}/fileManagerController/updateFolder",
		data:$("#updateFolderForm").serialize(),
		success : function(data) {
			loadTreeRoot();
			bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
			$("#updateModal").modal("hide");
		}
	});
}
/**
 * 修改文件提交
 */
 function updatefileFormSubmit(){
	 var fileName = $("#updatefileForm input[name='fileName']").val();
	 if ("" == fileName || fileName.length > 64) {
		alert("文件夹名称不能为空且在64个字符以内!");
		return;
	 }
	 $.ajax({
			type : "POST",
			url : "${proPath}/fileManagerController/updateFileManagerFile",
			data:$("#updatefileForm").serialize(),
			success : function(data) {
				if(data!=null){
					 $("#updateModal").modal("hide");
					var target = $(".breadcrumb li").last().find('a').attr('href');
					$.get(target,function(data){
		                 $("#mainIframe").html(data);
		            });  
				}
				bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
			}
		});
}
//文件搜索
function searchFile(){
	$.ajax({
 		type : "POST",
 		url : "${proPath}/sysParamDictController/searchSysParamlist",
 		data:$("#searchFileForm").serialize(),
 		success : function(data) {
 			if(data!=null){
 				$("#searchFileMobal").html(data);
 				$("#searchFileMobal").modal("show");
 			}
 		}
 	});  
	//
}


//文件搜索提交
 function submitSearchFile(){
 	$.ajax({
 		type : "POST",
 		url : "${proPath}/fileManagerController/searchFilManagerFile",
 		data:$("#searchFileForm").serialize(),
 		success : function(data) {
 			if(data!=null){
 				$("#searchFileMobal").modal("hide");
	            $("#mainIframe").html(data);
 			}
 		}
 	});  
 }
/**
 * 显示qr码
 */
function ShowImage(obj){
	var oTr = $(obj).parent().parent();
	if(oTr.attr("filetype")==0){
		var imagePath=oTr.attr("timagePath");
		$("#image").attr("src",imagePath);
		$("#image").attr("folderId",oTr.attr("id"));
		$("#ImageModal").modal("show");
	}
}
function userManagerModalShow(){
	$("#userManagerModal").modal("show");
}
//账号管理
function AccountSumbit(userId,userAccount){
		var oldpassword=$("#oldpassword").val();
		var newpassword=$("#newpassword").val();
		var newpassword2=$("#newpassword2").val();
		if(userId==null&&userAccount==null){
			alert("您可能是异常登录，，请联系管理员后在来修改密码");
			return ;
		}
		if(newpassword==null){
			alert("请输入要修改的密码");
			return ;
		}
		if(newpassword2!=newpassword){
			alert("两次输入的密码不一致");
			return ;
		}
		//判断要修改的是管理员还是技术人员\
		var type;
		if($("#showPassword").is(":hidden")){
			type=1;
		}else{
			type=0;
		}
	  $.ajax({
		   type: "POST",
		   url: "${proPath}/user/updateUser",
		   data:{
			   "newpassword":newpassword,
			   "oldpassword":oldpassword,
			   "type":type
		   },
		   success: function(msg){
			   if(msg=="success"){
				  alert("修改成功");
				  $("#userManagerModal").modal("hide");
			   }else{
				   if(msg=="error"){
					   alert("原始密码错误");
				   }else{
					   alert("修改密码失败")
				   }
			   }
		   },
		   error:function(){
			   alert("修改用户失败!");
		   }
		});  
 }
//改变修改密码的样式
function PasswordChange(type){
	if(type==1){
		$("#showPassword").show();
	}else{
		$("#showPassword").hide();
	}
} 
/* 下载 */
function download(obj) {
	if(obj.type=="button"){
		var id = $("#image").attr("folderId");
	}else{
		 var oTr = $(obj).parent().parent();
		 var id = oTr.attr("id");
	}
	window.open("${proPath}/fileManagerController/dowlond?id="+id,"_self");
}
function paginationClick(obj){
	var target = $(obj).find('a').attr('target');
    $.get(target,function(data){
        $("#mainIframe").html(data);
     });  
}
/*删除系统参数*/
function delSys(obj){
	$(obj).parent().parent().remove();
}
/*添加系统参数*/
function addSys(obj){
	$(obj).parent().parent().before('<tr style="text-align: center;"><td><input value="" type="text" name="name"/></td><td><span onclick="delSys(this)">删除</span></td></tr>');
}
/*关闭系统参数model*/
function closeSysParamModal(){
	$("#sysParamModal").modal("hide");
}
 
/*查看系统参数详情*/
function getSysParamDetails(obj){
	var type = $(obj).find("span").attr("type")
	$.ajax({
		   type: "POST",
		   url: "${proPath}/sysParamDictController/getSysParamDictByType",
		   data:{
			  "type":type
		   },
		   success: function(data){
			  $("#updateSysParamDiv").html(data);
		   },
		   error:function(){
			   alert("获取系统参数信息失败!");
		   }
		});  
}
/*修改系统参数提交*/
function submitSysParamUpdate(){
	$.ajax({
 		type : "POST",
 		url : "${proPath}/sysParamDictController/updateSysParam",
 		data:$("#updateSysParamForm").serialize(),
 		success : function(data) {
 			if(data!=null){
 				//$("#sysParamModal").modal("show");
 				//$("#updateSysParamDiv").html("");
 				bootbox.alert({buttons : {ok : {label : '确定',className : 'btn-primary'}},message : data.msg});
 			}
 		}
 	});  
}
 
</script>
</html>
